package com.example.demo.controller;

import com.example.demo.bean.Order;
import com.example.demo.sevice.OrederService;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
/*@RequestMapping("/order")*/
public class OrderController {
    @Autowired
    private OrederService orederService;

    //查询数据
    @RequestMapping("/find")
    public List<Order> find() {
        return orederService.find();
    }

    /*新增数据*/
    @RequestMapping("/ad")
    public void addOrder(@RequestParam("PatName") String PatName) {
        System.out.println(PatName);
        orederService.addOrder(PatName);
    }

    /*删除数据*/
    @RequestMapping("/delta")
    public void deleteOrder(@RequestParam("PatName") String PatName) {
        orederService.deleteOrder(PatName);
        System.out.println(PatName);
    }

    //*修改数据*//
    @PostMapping("/updata")
    public void updateOrder(Order order) {
        System.out.println(order);
        orederService.updateOrder(order);
    }

    //查询
    @RequestMapping("do")
    public List<Order> dou() {
        return orederService.dou();

    }

    //查询
    @RequestMapping("dou")
    public List<Order> dou1() {
        return orederService.dou1();
    }

    /*查询*/
    @RequestMapping("dou2")
    public List<Order> dou2() {
        return orederService.dou2();
    }

    /*查询*/
    @RequestMapping("dou3")
    public List<Order> dou3(String Hospital) {
        return orederService.dou3(Hospital);
    }
    /*查询*/
    @RequestMapping("dou4")
    public List<Order> dou4(String Hospital) {
        return orederService.dou3(Hospital);
    }

    @RequestMapping("dou5")
    public List<Order> dou5(String Hospital){
        return orederService.dou5(Hospital);
    }
}
